package com.woniu.after.app.apiImpl;

import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.woniu.after.client.RefundsApplyQueryClient;
import com.woniu.after.client.param.PageRefundsApplyParam;
import com.woniu.after.client.result.PageRefundsApplyResultInfo;
import com.woniu.after.infra.model.RefundsApply;
import com.woniu.after.service.RefundsApplyService;
import com.woniu.after.service.dto.PageRefundsApplyDto;
import com.woniu.after.service.form.PageRefundsApplyForm;
import com.woniu.result.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@Slf4j
public class RefundsApplyQueryApiImpl implements RefundsApplyQueryClient {

    @Resource
    private RefundsApplyService refundsApplyService;

    @Override
    public Result listRefundsApply(PageRefundsApplyParam pageRefundsApplyParam) {
        log.info("查询退款申请:{}", pageRefundsApplyParam);
        PageRefundsApplyForm pageRefundsApplyForm = BeanUtil.copyProperties(pageRefundsApplyParam, PageRefundsApplyForm.class);
        PageRefundsApplyDto pageRefundsApplyDto = refundsApplyService.listRefundsApply(pageRefundsApplyForm);
        PageRefundsApplyResultInfo pageRefundsApplyResultInfo = BeanUtil.copyProperties(pageRefundsApplyDto, PageRefundsApplyResultInfo.class);
        return Result.getInstance(PageRefundsApplyResultInfo.class).setMsg("查询成功").setCode(200).setData(pageRefundsApplyResultInfo);
    }
}
